import greenfoot.*;   // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;

public class Lifes extends Actor
{
    private int num;      //Number of lifes availables.
    private String m;

    public Lifes( int amount, String men){
        num = amount;
        m = men;
        this.show();}

    public void decrementa(){
        if( num > 0){
            num = num - 1;
            this.show();}}

    public void incrementa( int numb)
    {
        num = num + numb;
        this.show();
    }

    public int getNumLifes()     //This method returns the amount of lifes availables.
    {
        return num;
    }

    public void show()          //This method show on the screen the amount of lifes availables.
    {
        GreenfootImage notice;
        String text;
        if( num==0)
            text = m + "    ";     
        else
            text = m + num + "  ";
        notice = new GreenfootImage( text, 20, Color.BLACK, Color.YELLOW);
        setImage( notice);
    }

    public void act(){}    
}
